(:: pragma bea:global-element-parameter parameter="$inventoryCheck1" element="ns0:InventoryCheck" location="../WSDLs/InventoryCheck.wsdl" ::)
(:: pragma bea:global-element-parameter parameter="$returnData1" element="ns1:returnData" location="../WSDLs/mockDB.wsdl" ::)
(:: pragma bea:global-element-return element="ns0:InventoryCheckResponse" location="../WSDLs/InventoryCheck.wsdl" ::)

declare namespace ns1 = "http://www.example.org/mockDB/";
declare namespace ns0 = "http://www.example.org/InventoryCheck/";
declare namespace xf = "http://tempuri.org/ActivateNewCustomer/Transformation/test/";

declare function xf:test($inventoryCheck1 as element(ns0:InventoryCheck),
    $returnData1 as element(ns1:returnData))
    as element(ns0:InventoryCheckResponse) {
        <ns0:InventoryCheckResponse>
            {
                for $item_number in $returnData1/item_number
                return
                    <SKU>{ data($item_number) }</SKU>
            }
            <serial_mac>{ data($returnData1/serial_mac) }</serial_mac>
            <status>{ data($returnData1/status) }</status>
            <status_date>{ data($returnData1/status_date) }</status_date>
            <customerId>{ data($returnData1/customer_id) }</customerId>
            <serviceId>{ data($returnData1/service_id) }</serviceId>
            <partnerId>{ data($inventoryCheck1/partnerId) }</partnerId>
            <mvnoReferenceNumber>{ data($inventoryCheck1/mvnoReferenceNumber) }</mvnoReferenceNumber>
            <amdocs_user_id>{ data($returnData1/amdocs_user_id) }</amdocs_user_id>
        </ns0:InventoryCheckResponse>
};

declare variable $inventoryCheck1 as element(ns0:InventoryCheck) external;
declare variable $returnData1 as element(ns1:returnData) external;

xf:test($inventoryCheck1,
    $returnData1)